<%@ page contentType="text/html;charset=UTF-8" %>
<%@ taglib prefix="uct" uri="/WEB-INF/uct.tld" %>
<%@ taglib prefix="portal" uri="/WEB-INF/portal.tld" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <%@ include file="/common/sale/include/common-base.jsp"%>
  <script type="text/javascript" src="${ctx}/js/tools-upload.js"></script>
  <title>市场交易设置-${titleName}</title>
  <!-- Tell the browser to be responsive to screen width -->
  <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
</head>

<!-- 以下是body主体内容的模块区域 -->
<body class="hold-transition ${sysColor} sidebar-mini">
<div class="wrapper">

  <!-- top start -->
  <%@include file="/common/sale/top.jsp" %>
  <!-- top end -->
  <!-- left start -->
  <%@include file="/common/sale/left.jsp" %>
  <!-- left end-->

  <div class="content-wrapper">
    <!-- Main start -->
	<section class="content">
      <div class="row">
        <div class="col-xs-12">
        
        
         <form id="searchForm" class="form-horizontal">
			<input type="hidden" name="doCode" value="dymicSql"/>
		  </form>
		  
          <div class="box">
	          <div class="box-header with-border">
                 <h3 class="box-title"><i class="fa fa-info-circle fx2"></i> 基本信息</h3>
                 <div class="box-tools pull-right">
	                <button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i>
	                </button>
                 </div>
              </div>
              <div class="box-body">
              
              		<div class="col-sm-9">
				  		<div class="form-group col-sm-6">
							<label  class="col-sm-4 control-label">商品代码</label>
							<div class="col-sm-6">
								<input type="text" data-name="trpProduct.proNo" class="form-control" disabled="disabled"/>
							</div>
						</div>
						
	                	<div class="form-group col-sm-6">
							<label  class="col-sm-4 control-label">商品名称</label>
							<div class="col-sm-6">
					  			<input type="text" data-name="trpProduct.proName" class="form-control" disabled="disabled"/>
							</div>
						</div>
						
	                	<div class="form-group col-sm-6">
							<label  class="col-sm-4 control-label">商品状态</label>
							<div class="col-sm-6">
					  			<input type="text" data-name="trpProduct.proStatus" data-dict="proStatus" class="form-control" disabled="disabled"/>
							</div>
						</div>
						
						<div class="form-group col-sm-6">
							<label  class="col-sm-4 control-label">交易单位</label>
							<div class="col-sm-6">
					  			<input type="text" data-name="trpProduct.proUnit" data-dict="productUnit" class="form-control" disabled="disabled"/>
							</div>
						</div>
					</div>
					
					<div class="col-sm-3" >
						<div class="form-group col-sm-12" id="div_show_1" style="display:none;">
				       		<button type="button" class="btn btn-danger" onclick="toAdd();">① 先设置首日开盘价</button> 
				       </div>
				       <div class="form-group col-sm-12" id="div_show_2" style="display:none;">
		     				<form class="form-horizontal" role="form" id="setTransRulesForm" action="javascript:void(0)">
			                <input type="hidden" name="pageName" value="bjtesale-trans-set"/>
							<input type="hidden" name="formName" value="setTransRulesForm"/>
						    <input type="hidden" id="setTransStartForm_formToken1" name="formToken" />
							<input type="hidden" name="doCode" value="dymicSql"/>
							<input type="hidden" name="trpProduct.w_proId" value="${param.proId}"/>
							<input type="hidden" name="trpProduct.proStatus" value="21"/>
							<input type="hidden" name="tQuotation.status" value="F"/>
							<input type="hidden" id="tQuotation_proId" name="tQuotation.proId" value="${param.proId}"/>
							<input type="hidden" name="tQuotation.proNo" data-name="trpProduct.proNo" />
							<input type="hidden" name="tQuotation.proName" data-name="trpProduct.proName" />
							<input type="hidden" name="tQuotation.lastPrice" data-name="trpProduct.transPrice" />
							<input type="hidden" name="tQuotation.openPrice" data-name="trpProduct.transPrice" />
							</form>
					       	<button class="btn btn-warning" type="button" onclick="saveTransQuotationForm('setTransRulesForm');">② 设置完规则，初始行情 </button>
				        </div>
				        <div class="form-group col-sm-12" id="div_show_3" style="display:none;">
		     				<form class="form-horizontal" role="form" id="setTransStartForm" action="javascript:void(0)">
			                <input type="hidden" name="pageName" value="bjtesale-trans-set"/>
							<input type="hidden" name="formName" value="setTransStartForm"/>
						    <input type="hidden" id="setTransStartForm_formToken2" name="formToken" />
							<input type="hidden" name="doCode" value="dymicSql"/>
							<input type="hidden" name="trpProduct.w_proId" value="${param.proId}"/>
							<input type="hidden" name="trpProduct.proStatus" value="30"/>
							<input type="hidden" name="tQuotation.w_proId" value="${param.proId}" />
							<input type="hidden" name="tQuotation.status" value="T"/>
							</form>
					       	<button class="btn btn-danger" type="button" onclick="saveTransStartForm('setTransStartForm');">③ 开启交易 </button>
				        </div>
					</div>
						
			         	
			       
		       </div>
		       
				   </div>
				    
	     	</div>
        </div>
        
        <div class="box" id="div_show_rule" style="display:none;">
	          <div class="box-header with-border">
                 <h3 class="box-title"><i class="fa fa-cog fx2"></i> 交易参数</h3>
                 <div class="box-tools pull-right">
	                <button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i>
	                </button>
                 </div>
              </div>
              <div class="box-body" id="rulespro-body">
              
					
	     	 </div>
	     	 <div class="form-group box-footer clearfix">
	     		<div class="col-sm-5 pull-left">
		       		<button type="button" class="btn btn-default" onclick="resetTransRules();"><i class="fa fa-cog"></i> 重新初始化参数</button> 
		       </div>
         	 </div>
		       
		   </div>
        </div>
        	
      </div>
    </section>
    <!-- Main end -->
  </div>
  <!-- /.content-wrapper -->
  <!-- foot start -->
  <%@include file="/common/sale/foot.jsp" %>
  <!-- foot start -->
  

<div class="modal fade" id="my_modal_trans" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
	<div class="modal-dialog" style="width:700px;">
				<div class="modal-content">
					<div class="modal-header">
						<button type="button" class="close" data-dismiss="modal" aria-hidden="true">
							×
						</button>
						<h4 class="modal-title">
							<font color="red">设置开盘价</font> 
						</h4>
					</div>

					<div class="modal-body">
						
					       <div class="nav-tabs-custom">
					            <ul class="nav nav-tabs" >
					            </ul>
					            
					            <!-- tab content start -->
					            <div class="tab-content">
					            
					                  
					               <div class="tab-pane active">
					                  <form class="form-horizontal" role="form" id="setOpenPriceForm" action="javascript:void(0)">
					                    <input type="hidden" name="pageName" value="bjtesale-trans-set"/>
										<input type="hidden" name="formName" value="setOpenPriceForm"/>
									    <input type="hidden" id="setOpenPriceForm_formToken" name="formToken" />
										<input type="hidden" name="doCode" value="dymicSql"/>
										<input type="hidden" name="trpProduct.w_proId" value="${param.proId}"/>
										<input type="hidden" name="trpProduct.proStatus" value="20"/>
										
											<div class="form-group col-sm-12">
												<label  class="col-sm-5">请设置[<span data-name="trpProduct.proNo" ></span>-<span data-name="trpProduct.proName" ></span>]开盘价</label>
												<div class="col-sm-4">
										  			<input class="form-control" id="trans-open-price" name="trpProduct.transPrice" maxLength="10" />
												</div>
											</div>
											<div class="form-group col-sm-12">
												<div class="col-sm-10">
										  			<i class="fa fa-info-circle fx2" style="color:#FFCC33;"></i> 一般以商品发行价作为流通市场首日交易的开盘价。
										  			<button class="btn btn-warning btn-xs" type="button" onclick="getSaleByProId();"> 点此获取发行价格 </button>
												</div>
											</div>
											
					                    
					                    <div class="form-group">
								        	<div class="col-sm-11">
									         <div class="box-footer text-center">
									         	<button class="btn btn-danger" type="button" onclick="saveTransForm('setOpenPriceForm','trans');"> 设置完成 </button>
					            			</div>
				            				</div>
				            			</div>
				            			
					                  </form>
					               </div>
					               
				            </div>
					            <!-- tab content e -->
				          </div>	
			                
					</div>
				</div>
				<!-- /.modal-content -->
			</div>		
</div>  

<div style="display:none;">
	<form id="transRulesSubmitForm">
			<input  name="pageName" value="trs-rules-pro"/>
			<input  name="formName" value="addFormInitData"/>
			<input  name="ifBatch" value="T"/>
			<input  name="trsRulesPro.splitAttr" value="rulesNo"/>
			<div id="transRulesSubmitDiv"></div>
	</form>
</div>

</body>
<script type="text/template" id="rulespro-template">

	<? for ( var i = 0; i < rows.length; i++) {?>
		<div class="form-group col-sm-6">
			<label  class="col-sm-5 control-label"><?=rows[i].trsRulesPro.formulaName?></label>
			<div class="col-sm-5">
				<input id="rsp-<?=rows[i].trsRulesPro.rulesProId?>" data-bv-regexp="<?=strUtil.doNull(rows[i].trsRulesPro.showValid,'')?>" data-bv-regexp-message="<?=strUtil.doNull(rows[i].trsRulesPro.showTip,'必填项')?>" onblur="saveRulesPro(this)" formulaSrc="<?=rows[i].trsRulesPro.formulaSrc?>" paramNo="<?=rows[i].trsRulesPro.paramNo?>"  paramName="<?=rows[i].trsRulesPro.paramName?>" rulesproid="<?=rows[i].trsRulesPro.rulesProId?>" class="form-control fx12 trans-rules" value="<?=strUtil.doNull(rows[i].trsRulesPro.paramNo,'')?>" maxlength="12"/>
				<span style="color:#dd4b39;font-size:12px;">*格式是<?=strUtil.doNull(rows[i].trsRulesPro.showTip,'必填项')?></span>
			</div>
			<span  class="col-sm-1"><?=strUtil.doNull(rows[i].trsRulesPro.paramUnit,'')?></span>
			<!--<span  class="col-sm-1 fx2"><i class="fa fa-remove"></i></span>-->
		</div>
   <?}?>
</script>
</html>

<!-- 以下是js模块区域 -->
<script>
var clickMenu = "bjtesale-trans-list";
var id,myPage,dataListId,searchFormId,isShowLog,tableSort,tableId,token;
myPage = 10;
dataListId = "dataList";
searchFormId = "searchForm";
tableSort = "trsSale";
tableId = "saleId";
isShowLog = true;
var proId = "${param.proId}";
var cateNo = "";

$(function () {
	//1、加载分页列表数据
	//2、控制是否启用token
	setToken();
	
	getProductById();
	
	
	//请在下面补充其他初始化方法（如数据字典、页面加载数据等）
	//3、初始化数据字典
 });
var dateObject = $('.datepicker').datepicker( {
	language : 'zh-CN',
	//inline: true,
	todayBtn : "linked",
	format : "yyyy-mm-dd",
	autoclose: true
});

//获取商品对象
function getProductById(){
	if(strUtil.isNull(proId)){
		alert("缺失参数");
		return;
	}
	
	var paramLoadData = {"formName":"searchForm1","pageName":"bjtesale-reg-list.jsp","trpProduct.w_proId":proId};
	$.ajax({
	    type:'get',
	   	url:common_info_url+"?doCode=dymicSql",
	    data: paramLoadData,
	    async:false,
	    dataType:"json",
	    success: function(myData){
	    	console.log(myData);
			FormUtil.loadView("trpProduct", myData);
			cateNo = myData.cateNo;
			var proStatus = myData.proStatus;
			if(proStatus=="10"){
				$("#div_show_1").show();
				$("#div_show_2").hide();
				$("#div_show_3").hide();
				$("#div_show_rule").hide();
			}else if(proStatus=="20"){
				$("#div_show_1").hide();
				$("#div_show_2").show();
				$("#div_show_3").hide();
				$("#div_show_rule").show();
				getTransRulesAllList(); 
			}else if(proStatus=="21"){
				$("#div_show_1").hide();
				$("#div_show_2").hide();
				$("#div_show_3").show();
				$("#div_show_rule").show();
				getTransRulesAllList(); 
			}else if(proStatus=="30"){
				$("#div_show_1").hide();
				$("#div_show_2").hide();
				$("#div_show_3").hide();
				$("#div_show_rule").show();
				getTransRulesAllList(); 
			}else{
				$("#div_show_1").hide();
				$("#div_show_2").hide();
				$("#div_show_3").hide();
				$("#div_show_rule").show();
				getTransRulesAllList(); 
			}
	  	}
	});
}
//获取中签交款结束的发行活动
function getSaleByProId(){
	if(strUtil.isNull(proId)){
        layer.alert("缺失参数");
		return;
	}
    var index_load = layer.load(1, {shade: false});
	var paramLoadData = {"pageName":"bjtesale-pub-list.jsp","formName":"searchForm1","trsSale.w_delStatus":"F","trsSale.w_saleStatus":"70","trsSale.proId":proId};
	$.ajax({
	    type:'get',
	   	url:common_list_url+"?doCode=dymicSql",
	    data: paramLoadData,
	    async:false,
	    dataType:"json",
	    success: function(myData){
	    	console.log(myData);
	    	layer.close(index_load);
			if(myData.total>0){
				if(myData.total==1){
					var sale = myData.rows[0];
					var salePrice = sale.priceInit;
					$("#trans-open-price").val(salePrice);
				}else{
					var salePrice = "";
					for(var i=0;i<myData.total;i++){
						salePrice += "￥"+myData.rows[i].priceInit+"&nbsp;&nbsp;&nbsp;";
					}
					layer.alert("获取到多个发行价格，请选择：<br/>"+salePrice);
				}
			}else{
				layer.alert("未找到对应发行价格");
			}
	  	}
	});
}

//清空数据
function cleanData(id){
	$('#'+id).find(".clean").val("");//按照样式清空；
}
//打开设置开盘价规则
function toAdd(){
	cleanData('setOpenPriceForm');//清空模态窗口内数据
	$("#w_"+tableId).val("");
	$(".datepicker").val("");
	$('#my_modal_trans').modal('show');
}

/****  以下是自定义新增方法  ****/
//添加开盘价页面保存
function saveTransForm(formId,type){
	var pObj = $("#trans-open-price");
	if(strUtil.isNull(pObj.val())){
		var txtId = pObj.attr("id");
		layer.tips("请设置开盘价的值", '#'+txtId, {tips: 2});
		 $("#"+txtId).focus();
		return false;
	}
	$(".eqopenprice").val(pObj.val());
	var index_submit = layer.confirm('您确定要保存信息吗？', {btn: ['Yes','No'],closeBtn: 0,offset: '220px'}
	, function(){
		layer.close(index_submit);
		var index_load = layer.load(2, {shade: false,offset: '220px'});
		$.ajax({
		    type:'post',
		    url:common_submit_url,
		    data:$("#"+formId).serialize(),
		    async:false,
		    dataType:'json',
		    success: function(myData){ 
		     console.log(myData);
		        layer.close(index_load);
		        if(myData.flag=="T"){
		        	layer.alert("操作成功");
		        	$('#my_modal_trans').modal('hide');
		        	addTransRules();
		        	getProductById();
		    	}else{
		    		layer.alert("操作失败："+myData.msg);
		    	}
		  	}
		});
	});
}

//判断交易规则是否存在未填写的情况
function checkRulesInput(){
	var f = true;
	$("#rulespro-body").find(".trans-rules").each(function(){
		if(strUtil.isNull($(this).val())){
			layer.alert("请先设置完交易规则！");
			f = false;
			return;
		}
	});
	return f;
}
//初始化行情
function saveTransQuotationForm(formId){
	var rulesFlag = checkRulesInput();
	if(!rulesFlag)return;
	
	var index_submit = layer.confirm('确认初始化商品[${param.proNo}]的交易行情数据吗？', {btn: ['Yes','No'],closeBtn: 0,offset: '220px'}
	, function(){
		setToken();
		layer.close(index_submit);
		var index_load = layer.load(2, {shade: false,offset: '220px'});
		$.ajax({
		    type:'post',
		    url:common_submit_url,
		    data:$("#"+formId).serialize(),
		    async:false,
		    dataType:'json',
		    success: function(myData){ 
		     console.log(myData);
		        layer.close(index_load);
		        if(myData.flag=="T"){
		        	layer.alert("操作成功");
		        	getProductById();
		    	}else{
		    		layer.alert(myData.msg);
		    	}
		  	}
		});
	});
}
//开启行情，开始交易
function saveTransStartForm(formId){
	var rulesFlag = checkRulesInput();
	if(!rulesFlag)return;
	var index_submit = layer.confirm('开启后，此商品将会开始交易流通，确认开启？', {btn: ['Yes','No'],closeBtn: 0,offset: '220px'}
	, function(){
		layer.close(index_submit);
		var index_load = layer.load(2, {shade: false,offset: '220px'});
		setToken();
		//开启行情，开始交易
		$.ajax({
		    type:'post',
		    url:common_submit_url,
		    data:$("#"+formId).serialize(),
		    async:false,
		    dataType:'json',
		    success: function(myData){ 
		     console.log(myData);
		        layer.close(index_load);
		        if(myData.flag=="T"){
		        	layer.alert("操作成功");
		        	getProductById();
		    	}else{
		    		layer.alert(myData.msg);
		    	}
		  	}
		});
	});
}


<%--function doDele(paramData){--%>
<%--	$.ajax({--%>
<%--	    type:"post",--%>
<%--	    url:common_submit_url+"?doCode=dymicSql",--%>
<%--	    data: paramData,--%>
<%--	    dataType:"json",--%>
<%--	    success: function(myData){--%>
<%--	    	var result = myData.flag;--%>
<%--	    	if(result!="T"){--%>
<%--	    		layer.alert("操作失败！");--%>
<%--	    	}--%>
<%--	  	}--%>
<%--	});	--%>
<%--}--%>

  //获取交易规则
  function getTransRulesAllList(){
	  var a = layer.msg("数据加载中...");
	  var paramData = {"pageName":"trs-rules-pro","formName":"searchForm","trsRulesPro.w_showFlag":"T","trsRulesPro.w_rulesType":"guadan","trsRulesPro.w_prodId":proId,"orderBy":"trsRulesPro.rules_no"};
	  $.ajax({
		   type:'get',
		   url:common_list_url,
		   data:paramData,
		   dataType:'json',
		   success: function(myData){
               console.log("交易规则查询结果：",myData);
			   if(myData.flag="T"){
				   var data = baidu.template("rulespro-template",eval(myData));
					$("#rulespro-body").html(data);
					layer.close(a);
			   }
		   }
	  }); 

  }  
  
//获取品种下商品申购时定义的规则，实例此商品规则。
function addTransRules(){
    var msgIndex = layer.msg("正在初始化交易参数");
    var paramData = {"pageName":"trs-rules-pro","formName":"addFormInitData","sysRulesProd.w_cateNo":cateNo,"trsRulesPro.prodId":proId,"rulesType":"guadan","formToken":token};
    $.ajax({
        type:'post',
        url:common_submit_url,
        data:paramData,
        dataType:'json',
        async:false,
        success: function(myData){
            console.log("初始化结果：",myData);
            if("T"==myData.flag){
               // layer.alert("初始化成功！");
                layer.close(msgIndex);
                getTransRulesAllList();
			}else{
                layer.alert("初始化失败！"+myData.msg);
			}
        }
    });
}
/**
 *
 *

 function addTransRules-bark(){
	var msgIndex = layer.msg("正在初始化交易参数");
 	var paramData = {"doCode":"dymicSql","modelTypes":"s_trpRulesParam","trpRulesParam.w_cateNo":cateNo,"trpRulesParam.w_rulesType":"guadan"};
 	$.ajax({
 		   type:'get',
 		   url:common_list_url,
 		   data:paramData,
 		   dataType:'json',
 		   async:false,
 		   success: function(myData){
 			console.log(myData);
 			//循环遍历规则列表
 			if(myData.total>1){
				var objHtmlAll="";
				for(var i=0;i<myData.rows.length;i++){
					var rulesObj = myData.rows[i];

					var newObj = {};
					for(var name in rulesObj){
						newObj["trsRulesPro."+name] = rulesObj[name];
					}
					//newObj["trsRulesPro.saleId"] = saleId;
					newObj["trsRulesPro.prodId"] = proId;
					for(key in newObj){
						objHtmlAll+="<input name='"+key+"' value='"+strUtil.doNull(newObj[key],'')+"'/>";
					}
					objHtmlAll+="<br/><br/>";
					console.log("newObj["+i+"]"+newObj);

				}
				$("#transRulesSubmitForm").html(objHtmlAll);
				setToken();
				 $.ajax({
					   type:'post',dataType:'json',data:$("#transRulesSubmitForm").serialize(),async:false,
					   url:common_submit_url+"?doCode=dymicSql&modelTypes=ib_trsRulesPro&ifBatch=T&trsRulesPro.splitAttr=rulesNo&formToken="+token,
					   success: function(myData){ }
				  	});
			}
 			layer.close(msgIndex);
 		   }
 		});
   }

 **/
//获取商品所有交易规则数据
  function getTransRules(){
	  var proRulesData = null;
	  var paramData = {"pageName":"trs-rules-pro","formName":"searchForm","trsRulesPro.w_rulesType":"guadan","trsRulesPro.w_prodId":proId};
	  $.ajax({
		   type:'get',
		   url:common_list_url,
		   data:paramData,
		   dataType:'json',
		   async:false,
		   success: function(myData){
			   console.log("交易规则查询结果：",myData);
			   proRulesData = myData;
		   }
	  });
	  return proRulesData;
  }
  //重置交易规则
  function resetTransRules(){
	  var index_submit = layer.confirm('此操作将会删除商品[${param.proNo}-${param.proName}]所有交易参数设置，重新初始化规则，您确认继续执行吗 ？', {btn: ['继续','放弃'],closeBtn: 0,offset: '220px'}
		, function(){
			setToken();
			layer.close(index_submit);
			var msgIndex = layer.msg("正在删除历史交易参数");
			var paramData = {"pageName":"trs-rules-pro","formName":"delForm","trsRulesPro.w_rulesType":"guadan","trsRulesPro.w_prodId":proId,"formToken":token};
			  $.ajax({
				   type:'post',
				   url:common_submit_url,
				   data:paramData,
				   dataType:'json',
				   success: function(myData){
						console.log(myData);
					   if(myData.flag="T"){
						   msgIndex = layer.msg("正在初始化交易参数");
						   addTransRules();

					   }
				   }
			  });
		});
  }
//自动保存每个规则参数值
  function saveRulesPro(o){
	  var obj = $(o);
	  var objId = obj.attr("id");
	  var paramNoNew = obj.val();
	  
	  var pattern = obj.attr("data-bv-regexp");
	  var patternMess = obj.attr("data-bv-regexp-message");
	 /** if(strUtil.isNull(paramNoNew)){
		  layer.tips("不能为空", '#'+objId, {tips: 3});
		  $("#"+objId).focus();
		  return;
	  }
	  **/
	  var regObj = new RegExp(pattern);
	  var result = regObj.test(paramNoNew);
	  //var result = paramNoNew.match(regObj);
	  if(!result){
		  layer.tips(patternMess, '#'+objId, {tips: 3});
		  $("#"+objId).focus();
		  obj.val("");
		  return;
	  }
	  
	  var paramName = obj.attr("paramName");
	  var paramNoOld = obj.attr("paramNo");
	  var rpid = obj.attr("rulesproid");
	  
	  if(paramNoNew && paramNoNew!==paramNoOld){
		  
		  var formulaSrc = obj.attr("formulaSrc");
		  var inputName = "trsRulesPro.paramNo";
		  var formulaCalNew = formulaSrc;
		  if(formulaSrc.indexOf(inputName)>-1){
			  //formulaCalNew=formulaSrc.replace(inputName,paramNoNew);
			  formulaCalNew = formulaSrc.replace(new RegExp(inputName,"gm"),paramNoNew);//进行多行全局匹配
		  }
		  setToken();
		  var paramData = {"pageName":"trs-rules-pro","formName":"editForm","trsRulesPro.w_rulesProId":rpid,"trsRulesPro.paramName":paramName,"trsRulesPro.paramNo":paramNoNew,"trsRulesPro.formulaCal":formulaCalNew,"formToken":token};
		  $.ajax({
			   type:'post',
			   url:common_submit_url,
			   data:paramData,
			   dataType:'json',
			   success: function(myData){
					console.log(myData);
				   if(myData.flag="T"){
					   obj.attr("paramNo",paramNoNew);
					   layer.tips("保存成功", '#'+objId, {tips: 3});
				   }
			   }
		  });
	  }
  }
</script>



